Speeding up document loading

ABSTRACT

Methods, systems, and apparatus, including computer programs encoded on a computer storage medium, for speeding up document loading. In some implementations, a resource of a document is requested from a first source, and metadata for the document is requested from a second source that is different from the first source. The requested metadata is received from the second source, and the requested resource is received from the first source. A first representation of the document based on the received metadata is provided for display. After providing the first representation, a second representation of the document that combines portions of the first representation with additional portions of the document is generated, and the second representation is provided for display.

CROSS-REFERENCE TO RELATED APPLICATION

This application is a continuation of U.S. application Ser. No.14/567,547, filed Dec. 11, 2014, which is a continuation of U.S.application Ser. No. 14/086,041, filed Nov. 21, 2013. The entirecontents of each of the previous applications are incorporated byreference.

TECHNICAL FIELD

This specification generally describes technology for speeding updocument loading.

BACKGROUND

Many types of electronic devices access web pages and other documentsover networks, such as the Internet. A single document may includecontent from multiple resources. For example, a URL for a document mayidentify a HyperText Markup Language (HTML) file, and the HTML file mayreference additional components, such as style sheets, images,advertisements, other HTML files to be displayed in in-line frames, andother components. There is often a significant delay between the time auser requests a document with a web browser and the time that a usefulview of the document is displayed.

SUMMARY

To speed up the presentation of a document to a user, a device canrequest the document over a network and also request metadata, such aslayout or formatting information for the document, from another source.The metadata can allow the device to determine an accurate layout forthe document early in the process of rendering the document.

Often, the process of loading a document involves discovering componentsof the document one by one. When components of a document are discoveredsequentially, the discovery of each new component may introduceadditional delays as the new component is identified, fetched, andprocessed. In many instances, processing a component reveals that yetadditional components must be fetched and processed to complete therendering of the document. As new components of the document arediscovered and processed, the web browser may repeatedly change thedisplayed view of the document. The repositioning and resizing ofelements in the document, which is often referred to as “reflow,” canshift content in a manner that hinders users' consumption of displayedcontent while components of the document are still being retrieved andprocessed.

To reduce delays in presenting documents to users, metadata indicatinglayout, formatting, or other information about a document can beprovided before the information can typically be computed duringconventional resource discovery. Before a client device attempts to loada document, a computing system can analyze the document to identify orgenerate metadata that can speed up presentation of the document. Forexample, the computing system can identify and extract the portions ofvarious cascading style sheets (CSS) that are needed to render thedocument. The computing system can also determine, for example, thefinal sizes and positions of elements in the document after the documentis fully rendered and scripts in the document have been interpreted. Theidentified portions of CSS files and the sizes and positions of elementscan be stored as metadata corresponding to the document, and can beprovided in response to requests by client devices. Because the layoutof a document does not change as frequently as the text, images, orother content of the page, the metadata will often provide accurateinformation about the layout of the document, even after the contentprovider alters the content of the page.

When a client device navigates to the document, a web browser of theclient device may request the document over a network. The web browsermay also separately request metadata for speeding up presentation of thedocument. For example, the web browser may send a request to a metadataservice, where the request includes the Universal Resource Locator (URL)of the document being loaded. The metadata service can then provide themetadata that was previously generated and stored for the document.Because the web browser can request metadata for the document beforeidentifying the specific resources or embedded components referencedwithin the document, the metadata can be requested before any portion ofthe document is received and processed. As a result, by the time the webbrowser receives or processes an HTML file or other portion of thedocument, the metadata indicating characteristics of the layout of thedocument can already be present at the client device. Using themetadata, the web browser can provide early views of the document withan accurate layout and formatting even while additional components ofthe document are still being discovered, downloaded, and processed.

In some implementations, a referring web page that includes a link to alanding page can include metadata for speeding up loading of the landingpage. When the referring page is loaded, the metadata for the landingpage is automatically retrieved. When a user interacts with the link inthe referring page, the user's client device already has metadata forthe landing page and can quickly provide a view of the landing page. Insome implementations, the referring page is a search engine results pagethat includes links to search result documents. The referring page mayinclude metadata for speeding up loading of one or more of the searchresult documents. In addition, or as an alternative, the referring pagemay cause metadata for the search result documents to be retrieved priorto, or in response to, user interaction with links to the search resultdocuments.

In a general aspect, a method includes: requesting a resource of adocument from a first source; before receiving the requested resource,requesting metadata for the document from a second source that isdifferent from the first source; receiving the requested metadata forthe document from the second source; receiving the requested resource ofthe document from the first source; providing, for display, a firstrepresentation of the document based on the received metadata from thesecond source; and after providing, for display, the firstrepresentation of the document based on the metadata from the secondsource: (i) generating a second representation that combines portions ofthe first representation with additional portions of the document; and(ii) providing, for display, the second representation that combinesportions of the first representation with the additional portions of thedocument.

Other embodiments of this aspect include corresponding systems,apparatus, and computer programs, configured to perform the actions ofthe methods, encoded on computer storage devices. A system of one ormore computers can be so configured by virtue of software, firmware,hardware, or a combination of them installed on the system that inoperation cause the system to perform the actions. One or more computerprograms can be so configured by virtue having instructions that, whenexecuted by data processing apparatus, cause the apparatus to performthe actions.

Implementations may include one or more of the following features. Forexample, requesting metadata for the document from the second sourcethat is different from the first source includes requesting metadata forthe document from a second source that is not identified by resources ofthe document. Providing, for display, the first representation of thedocument based on the received metadata from the second source includes:providing a first representation of the document that includes adisplayable element indicated from the received resource of the documentat a position and size indicated by the metadata received from thesecond source. Providing, for display, the first representation of thedocument based on the received metadata from the second source includes:determining, based on the received metadata, a region for display of anelement of the document, before receiving resources of the document thatindicate the region for display of the element; and providing the firstrepresentation of the document that reserves a region of therepresentation for the element. Generating the second representationthat combines portions of the first representation with the additionalportions of the document includes: generating a second representationthat adds an additional displayable element of the document in aposition and size indicated by the received metadata from the secondsource.

Implementations may include one or more of the following features. Forexample, receiving the requested metadata for the document from thesecond source includes receiving metadata that includes style data froma cascading style sheet resource, the style data includes data in thecascading style sheet resource for one or more styles that are used inthe document, and the style data excludes data in the cascading stylesheet resource for one or more styles that are not used in the document.Receiving the requested metadata for the document from the second sourceincludes receiving data from a font resource of the document. Receivingthe requested metadata for the document from the second source includesreceiving, at a client device, data indicating characteristics of thelayout or formatting of a rendering of the document by a devicedifferent from the client device. The document includes JAVASCRIPTcontent that, when processed, affects the layout of one or more elementsof the document. Receiving the requested metadata for the document fromthe second source includes receiving data indicating a layout of the oneor more elements that reflects the effects of processing the JAVASCRIPTcontent. Receiving the requested metadata for the document from thesecond source includes receiving data indicating a location of a fold ofthe document. The method includes: based on the data indicating thelocation of the fold of the document, identifying content for display inan above-the-fold region of the document; and prioritizing processing ofthe content of the document such that the identified content for displayin the above-the-fold region is processed before processing content fordisplay outside the above-the-fold region.

The details of one or more implementations of the subject matterdescribed in this specification are set forth in the accompanyingdrawings and the description below. Other potential features, aspects,and advantages of the subject matter will become apparent from thedescription, the drawings, and/or the claims.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram that illustrates an example of a system forspeeding up document loading.

FIGS. 2A-2C are diagrams that illustrate examples of user interfacesshown while a document is loaded.

FIGS. 3A-3C are diagrams that illustrate examples of user interfacesshown while a document is loaded.

FIG. 4 is a diagram that illustrates an example of timing of events whenloading a document.

FIG. 5 is a flow diagram that illustrates an example of a process forspeeding up document loading.

FIG. 6 is a block diagram that illustrates an example of a system forspeeding up document loading.

FIGS. 7 and 8 are flow diagrams that illustrate examples of processesfor speeding up document loading.

Like reference symbols in the various drawings indicate like elements.

DETAILED DESCRIPTION

FIG. 1 is a block diagram that illustrates an example of a system 100for speeding up document loading. The system 100 includes a clientdevice 110, a first computing system 120, a second computing system 130,and a network 118. The figure shows stages (A) to (E) which illustrate aflow of data, and stages (E) and (F) which illustrate user interfacesshown on the client device 110.

In the example, a user 102 loads a document in a web browser of theclient device 110. The web browser requests the document from thecomputing system 120. Before receiving the document, the web browseralso requests data for speeding up loading of the document, referred togenerally as metadata or acceleration data, from the computing system130. The web browser uses the content of the document and independentlyprovided metadata to quickly provide the user 102 a view of thedocument. In some implementations, the requested metadata allows the webbrowser to reduce or avoid reflow when displaying the document. Therequested metadata may also allow the web browser to provide ameaningful view of the document (e.g., with accurate formatting andlayout) earlier than the web browser could provide by processing thecontent of the document alone.

The client device 110 can be, for example, a desktop computer, a laptopcomputer, a cellular phone, a smart phone, a tablet computer, a musicplayer, an e-book reader, a navigation system, or other device. Thefunctions performed by each of the computing systems 120, 130 can beperformed by individual computer systems or can be distributed acrossmultiple computer systems. The network 118 can be wired or wireless or acombination of both, and may include private networks and/or publicnetworks, such as the Internet.

Many web pages and other documents include content that is spread amongmultiple files. The URL for a document may correspond to a first file,such as an HTML file. The HTML file may reference one or more embeddedcomponents that must be downloaded to complete the document. Forexample, examples of embedded components include fonts, script files,CSS files, images, web applications, media files, and other HTML files.

As used herein, a “document” or “web page” refers generally to the setof resources that together make up the entirety of the document, and isnot limited to a single file such as an HTML file. For example, a webpage corresponding to the URL “www.example.com” may include an HTML file“www.example.com/index.html” as well components such as a CSS file“www.example.com/main.css,” an image file “www.example.com/image.jpg,” afont file “www.example.com/font.woff,” and other resources referenced inthe HTML file or other components of the document. Embedded componentsof the web page, while often retrieved as separate files from separateURLs, are typically needed to fully render or display the web page, andare retrieved and processed automatically by a web browser as part ofthe process of loading the web page.

When a web browser loads a web page, the web browser gradually discoversthe resources needed to render the web page. For example, when the webbrowser processes an HTML file, the web browser may determine thatcertain CSS files, font files, and other resources are also needed torender the web page. The web browser identifies and retrieves theseadditional resources, which may refer to yet more resources for the webbrowser to retrieve in order to complete the page.

As an example, a web page may include an HTML file that refers to afirst CSS file, which refers to a second CSS file, which refers to athird CSS file. Typically, the web browser determines that the first CSSfile is needed only after the HTML file for the web page is received andprocessed. Then, there is a delay as the web browser retrieves andprocesses the first CSS file. From the content of the first CSS file,the web browser determines that the second CSS file is needed, and thereis another delay as the web browser retrieves and processes the secondCSS file. From the content of the second CSS file, the web browserdetermines that the third CSS file is needed, and there is a third delayas the web browser retrieves and processes the third CSS file. Thisloading process involves sequentially loading and processing fourdifferent files, and each time another file is processed, reflow of theweb page may change the layout provided for display to the user.

To avoid the delays associated with sequential resource discovery andloading, some of the information needed to render the web page may beprovided as metadata early in the rendering process. For example, when aweb browser requests the HTML file for a web page, the web browser canalso request metadata for the web page from a metadata service thatassists in speeding up page loading. The metadata service can providethe content of multiple CSS files, even before the web browserdetermines that the CSS files are needed. As a result, when the webbrowser processes an HTML file, the web browser can take advantage ofthe information in the metadata to provide accurate layout andformatting with the initial view of the web page provided to the user.

In some implementations, a device requests a resource of a document froma first source. The device requests metadata for the document from asecond source that is different from the first source. The devicereceives the requested metadata for the document from the second source,and receives the requested resource of document from the first source.The device provides, for display, a first representation of the documentbased on the metadata received from the second source. After providingthe first representation of the document, the device generates a secondrepresentation of the document that combines portions of the firstrepresentation with additional portions of the document and provides thesecond representation for display.

In the example of FIG. 1, in stage (A), the user navigates to a web pageusing a web browser of the client device 110. For example, the user mayenter a URL for the web page or interact with a link to the web page.

In stage (B), the web browser of the client device 110 sends a request112 for the content of the web page (e.g., one or more of the actualresources of the document). The web browser sends the request 112 to thecomputing system 120, which is a server hosting the web page. Thecomputing system 120 may be operated by the content provider thatcreates or distributes the web page, or by a content delivery network orother entity that provides the web page on behalf of the contentprovider. The request 112 may be, for example, an HTTP “get” request forretrieving the resource corresponding to the URL of the web page (e.g.,the main HTML file for the web page).

In stage (C), the web browser of the client device 110 sends a requestfor data for speeding up loading of the web page. The request 114 isseparate from the request 112 and may be sent to a server, domain, orsystem different from the one than provides the web page. For example,the web browser can request metadata from a metadata service provided bythe computing system 130, which may be provided by a third partyindependent of the content provider and computing system 120. Therequest 114 identifies the web page that the client device 110 isloading, which allows the metadata service to provide metadata specificto the web page being loaded. For example, the request 114 may indicatethe URL for the web page.

The web browser can send the request 114 for metadata before receivingthe HTML file or any other resources of the web page. The metadataservice can provide metadata based on identification of the web pagealone, for example, without identification of the specific resourcesreferenced within the HTML file or within other components of the webpage. As a result, the requests 112, 114 can be issued in parallel, atapproximately the same time. In some implementations, the web browser isconfigured to send a request for metadata each time a new document isloaded to automatically enhance the loading process. For example, eachtime a new document is loaded, the web browser may send a request to ametadata service at a known location, e.g.,“www.example.com/metadata_service,” and request metadata for the page.

The computing system 130, upon receiving the request 114, determineswhether metadata is available for the web page identified in the request114. The computing system 130 can have access to data storage 135 thatincludes metadata for each of many different web pages. As discussedfurther with respect to FIGS. 6 and 7, metadata for a web page can beselected ahead of time based on analysis of a rendering of the web page.The selected metadata for each analyzed page can be stored and laterprovided to devices to speed up loading. The computing system 130 canlook up the URL of the web page in the stored data and provide anymetadata that has been designated for speeding up loading of that webpage.

In stage (D), the client device 110 receives the metadata 132 for theweb page from the computing system 130. The received data for speedingup loading of the web page is referred to generally as metadata, sincethe received data can include information about the manner in which theweb page should be displayed, such as sizes, positions, and styles ofelements of the web page. As discussed further below, the metadata 132can include a copy of data from resources of the web page. The metadata132 may additionally or alternatively include other data generatedthrough analysis of the web page.

In stage (E), the client device 110 receives one or more resources ofthe web page, such as an HTML file 122, from the computing system 120.Since the requests 112, 114 are issued at approximately the same time,the metadata 132 and the HTML file 122 are received at approximately thesame time. When the web browser processes the HTML file 122, informationabout the layout of the web page and information from embeddedcomponents is already present in the metadata 132. In this manner,information from embedded components (e.g., CSS files, script files,fonts, etc.) can be present at the client device 110 even before the webbrowser discovers references to those components and determines that theinformation is needed.

The received metadata 132 may include any of a variety of types ofinformation that can speed up presentation of the web page to the user102. In some implementations, the metadata 132 indicates layout orformatting of the web page. The metadata 132 may include informationabout a previous rendering of the web page. In some implementations, themetadata 132 includes information about the nodes in a DOM tree for theweb page and styles corresponding to the nodes. In some implementations,the metadata 132 describes characteristics of the document design orpage structure of the web page. In some implementations, the metadata132 includes non-displayable content from the web page, and excludes thedisplayable content of the web page. For example, in someimplementations, the metadata 132 may include any data from theresources of the web page other than images and text designated fordisplay to a user.

In some implementations, the metadata 132 includes data from embeddedcomponents (e.g., a portion of or all of one or more components) of theweb page. For example, as discussed further below, the metadata 132 mayinclude a copy of the data in one or more CSS files, or specificportions of CSS files, of the web page. In some implementations, themetadata 132 indicates a list of components to be downloaded, withoutincluding the data from those components. For example, the metadata mayidentify the CSS resources needed to render the web page, to speed upthe identification and retrieval of needed components. In someimplementations, the metadata 132 includes data from some components ofthe web page, and only identifies other components.

Some of the metadata 132 may indicate the layout or formatting of acompleted rendering of the web page. For example, the metadata 132 mayindicate positions and sizes of images and other elements displayed in aview of the web page. The metadata 132 may indicate final sizes andpositions of elements determined from a previous full rendering of theweb page by another device (e.g., a device other than the client device110). For example, the sizes and positions indicated can be sizes andpositions of elements as they occur after JAVASCRIPT code or otherscripts in the web page have been executed. As a result, the effect ofscripts that adjust the layout of the web page is already reflected inthe metadata 132.

In conventional loading processes, when a web browser first generates alayout for a web page, the web browser typically does not know the finallayout of the page. For example, the web browser may not be able toaccurately determine the final size of an image in the web page. Thebrowser may estimate the size of an image at first, but may have tochange the size or position of the image as additional resources arediscovered and processed. However, by providing the final sizes ofimages and other elements in metadata 132, the web browser's initialrendering can accurately place and size the image as it appears in thefinal rendering, and reflow can be avoided.

The metadata 132 may include script files or portions of scriptsembedded in the web page. In addition, or as an alternative, themetadata may include information about the effects of scripts on thelayout of the page, so that the appropriate features of the layout canbe included before actually downloading and executing the scripts.

The metadata 132 may include style data from CSS files embedded in theweb page. In some implementations, the metadata 132 includes the entireset of data in CSS files referenced by the web page. Multiple CSS filesmay be combined or in-lined to improve efficiency. In someimplementations, the metadata 132 includes only selected portions of theCSS files in the document, and omits portions of the CSS files that arenot actually needed to render the web page. For example, various CSSfiles referenced by the web page may total 50 kilobytes of data. Only 20kilobytes of the data may actually be needed to fully render the webpage. For example, style information relating to a particular type ofelement may be omitted if there are no elements of that type in the webpage. The metadata 132 may include a proper subset of the CSS data, suchas only the 20 kilobytes needed, to limit the amount of datatransferred.

The metadata 132 may include custom fonts used in the web page. Ratherthan including fonts, the metadata 132 may include a list of font filesthat are used and URLs for those fonts, to allow the web browser toretrieve the fonts before the web browser would typically determine thatthe fonts were needed.

In some implementations, the metadata 132 indicates the location of the“fold” of the web page. The location of the fold can represent thevisible portion of a page for a given screen size. Typically, the foldrefers to an edge or boundary of a display area in which a resource isdisplayed, such as the bottom edge of the display area for the web page.When a document is displayed in a web browser, the document typicallyextends beyond the initial viewing area of a web browser, and the usermust typically scroll or otherwise navigate within the document toreveal content not initially presented in the display area. The portionof a document that is initially viewable within the browser on theuser's display is referred to as the above-the-fold region of thedocument. For example, the above-the-fold region can be the portion of adocument shown in a display area after the resource is rendered anddisplayed, before the user scrolls to reveal additional content. Theremainder of the resource, which typically may be revealed by scrollingdownward within the browser, is referred to as a below-the-fold regionof the document.

In some implementations, the metadata 132 indicates which images arevisible for a given screen size. The metadata 132 may indicate multipledifferent sets of images visible at different sizes of screens ordisplay areas. The web browser may use information about the fold of theweb page and the images visible to prioritize processing of portions ofthe web page. For example, portions of the web page that are visible inthe above-the-fold region may be processed before other portions of theweb page that will not become visible until the user reveals them byscrolling.

The metadata 132 may exclude the viewable content of the web page. Forexample, text, images, and other visible elements in the web page areexcluded from the metadata 132, and are not provided by the computingsystem 130. For example, without including the actual text to be shownto the user, the metadata 132 may indicate the font and style for thetext and a location and size of an area in which to display text.Similarly, the metadata 132 can indicate sizes and locations of imagesin the layout of the page, and not include the images themselves.

In some implementations, the metadata 132 may include viewable contentof the web page. For example, the metadata 132 may include images fromthe web page. The metadata 132 may include actual images for thedocument, or may include lower resolution images or compressed imagesfor use in an early view of the document. In some instances, fewer thanall of the images that would be visible in the document are provided.For example, the subset of images provided may include images located ata central region of the document and/or images of at least a minimumsize, and may exclude the other images of the document. In someimplementations, the metadata includes images for display in theabove-the-fold region of the document (e.g., in the top portion orinitial view of the document that is visible before scrolling by theuser), and excludes images for display in the below-the-fold region ofthe document (e.g., the portion revealed by scrolling). Other criteriafor selecting images to provide in metadata may be used. In someimplementations, any portion of the web page may be provided to speed uploading of the page.

In stage (F), the web browser of the client device 110 provides a viewof the web page using the metadata 132, as shown in user interface 150.The web browser is configured so that the layout engine of the webbrowser creates the view of the page according to the information in themetadata 132. The metadata 132 can allow the web browser to provide aview of the web page more quickly than through analysis of the web pagealone. In addition, the initial view of the web page can include a moreaccurate layout than would be initially provided without the metadata.

The view that the web browser provides can include a portion of thecontent of the web page, formatted or arranged as indicated in themetadata 132. For example, the HTML file for the web page may includetext for display to the user 102, and the text may be shown in a styledefined by CSS in the metadata 132. As a result, the initial view can bemore accurate rather than a view based on the HTML file alone, and theview can be provided in less time than is required for discovery andretrieval of the CSS resources referenced in the web page. The text mayalso be displayed using font data included in the metadata 132.Similarly, images and other elements of the web page may be displayed atthe sizes and positions indicated by the metadata 132.

In some implementations, the web browser may provide a view of the webpage that is based on the metadata 132 before processing or beforereceiving the HTML file or other content of the web page. For example,if the metadata 132 is received much earlier than the HTML file for theweb page, the web browser may generate an initial view based entirely onthe metadata 132. The initial view may include, for example, images fromthe metadata 132, as well as headings or other portions of the web pagefrom h metadata 132, formatted according to CSS information and/orlayout information in the metadata.

If the content of an image or other element is not available when theweb browser provides the initial view of the web page, the web browsermay insert a placeholder or otherwise reserve the space that the elementwould occupy. After the element has been retrieved, the web browser maybe inserted into the designated space that has been reserved. Becausethe final size and position of the element is known when the initiallayout is generated, the element can be inserted into the web page atthe correct size and position without displacing other content of theweb page.

In some implementations, the metadata 132 instructs the web browser todefer invoking JAVASCRIPT or other scripts until after presenting theinitial view of the web page using the information in the metadata 132.As a result, the view of the web page can be provided without delays forprocessing JAVASCRIPT or other scripts.

Typically, JAVASCRIPT content does not cause much visible content to beadded to a view of a web page. In many instances, the majority of a webpage can be shown without processing JAVASCRIPT content. In otherinstances, however, JAVASCRIPT or other invokable content may affect thecontent displayed to the user. For example, JAVASCRIPT code may adjustthe position or size of an element displayed in the web page. As anotherexample, when interpreted by the browser, JAVASCRIPT code may insert anelement into the document object model (DOM) that the web browserconstructs for the web page. The insertion of the element may causeother elements, such as elements located below the inserted element inthe DOM tree, to change positions in the layout of the web page.

When the web browser defers processing of JAVASCRIPT content, the webbrowser can still lay out elements with accurate sizes and positionsusing the metadata 132. The metadata 132 can indicate characteristics ofthe final layout of the web page after all scripts and elements havebeen discovered and processed. By using the layout characteristicsindicated in the metadata 132, which already take into account anychanges caused by JAVASCRIPT or other invokable content, the web browsermay generate an accurate layout before JAVASCRIPT content is processed.As a result, even when JAVASCRIPT content that affects page layout hasnot been processed, the web browser can provide a view with an accuratelayout.

While the user interface 150 is displayed, the web browser continues theresource discovery process for loading the web page. Each component ofthe web page is identified, retrieved, and processed in turn, in thesame manner that the resources would normally be processed if themetadata 132 were not available. These components may be requested andreceived from the computing system 120 or other system, from the sameURLs specified within the web page. As new resources are discovered andretrieved, the web browser blends the newly retrieved content with theinitial view of the web page. In the user interface 150, display areas151 a, 152 a are set aside for elements for which the displayablecontent has not yet been received. At the time the user interface 150 isfirst displayed, the web browser may not yet have discovered theresources, or may be waiting for transfer of the resources to complete.Because the metadata 132 for the web page indicates the sizes andpositions of these elements, the space is reserved in the layout so theelements may be inserted later without altering the layout of the webpage.

In some implementations, resources that are included in the metadata 132(e.g., resources for which data is already present at the client device110) are also separately downloaded to the client device 110 during theresource discovery process after receiving the metadata 132. Forexample, even though the metadata 132 includes data in a CSS file of theweb page, the web browser may continue to discover, retrieve, andprocess the original CSS file that is provided by the content publisher.By processing the original resources, as received directly from thepublisher, the web browser may verify the correctness of the layout thathas been generated. Differences between the original resources of theweb page and the metadata 132 are resolved in favor of the originalresources. For example, if a CSS file indicates that an aspect of thelayout of the web page is different from what is indicated in themetadata 132, the web browser updates the view to reflect what is in theCSS file. Metadata of a web page typically changes infrequently.However, the actual resources of the web page will be most current, andin some instances, the metadata 132 may not include recent changes tothe metadata. Completing the resource discovery process can verifycorrectness can ensure that any recent changes to the web page areultimately incorporated in the view presented to the user 102.

In some implementations, portions of a document that are included in themetadata 132 are not separately downloaded during the resource discoveryprocess. For example, when the metadata 132 includes resources of theweb page or portions of the resources, the web browser may use theinformation in the metadata 132 without additionally downloading theresources from the server hosting the web page. As an example, the webbrowser may determine that the metadata 132 includes the portion of aCSS file that is needed to display a web page, and as a result, maydetermine not to download the CSS file from the URL indicated in an HTMLfile. The metadata 132 may indicate which resources or portions orresources are included in the metadata 132 to allow a web browser todetermine which resources may not need to be separately downloaded.

As the client device 110 receives and processes additional resources ofthe web page, the client device 110 may provide updates to the view ofthe web page. The layout engine of the web page may make multipleincremental updates to the view while the resource discovery process isongoing. These updates combine additional content of the web page withthe view in the user interface 150. Each update can provide a morecomplete view of the web page. New content may be added, and someelements, such as placeholders in the user interface 150 may be replacedwith the actual content of the web page. Through this series of updates,the user 102 can experience a seamless transition from the initial orpreliminary view of the web page in the user interface 150 to acomplete, final view of the web page. The use of metadata 132 allows theweb browser to generate the correct, final layout for the web page forthe initial view. As a result, merging or blending the additionalcontent involves placing content in the initial layout, and the pageloading process may be completed without reflow or alteration of thelayout of the page.

In stage (G), the web browser of the client device 110 provides userinterface 160, which is the final, completed view of the web page, afterdiscovering and processing all of the components of the web page.Elements that were not available when the user interface 150 wasprovided have been inserted into the view. For example, the displayareas 151 a, 152 a which were reserved for elements not yet availablehave been replaced with the actual content 151 b, 152 b (e.g.,displayable text, images, or other content) of the page. JAVASCRIPT, aswell as other scripts or instructions in the document, has also beeninvoked. In the initial view of the web page, some user interactionhandlers, such as click handling routines, may not be active wheninvocation of JAVASCRIPT or other code is deferred. However, as theresource discovery process proceeds, JAVASCRIPT is processed andinteraction handlers and other functional aspects of the web page areadded.

In general, use of the metadata 132 to speed up loading of the web pagedoes not require any alteration of the actual resources that make up theweb page. Unlike document compression of document rewriting, the exampleof FIG. 1 involves transmission of the original, unmodified content ofthe web page to the client device 110 in its entirety. The metadata 132is provided as supplemental information, in addition to the unalteredcontent of the web page provided by the content publisher. The metadata132 may be relied on only to provide an early view of the web page untilthe web browser has time to retrieve and process the web page, includingthe original metadata provided by the web page's origin server. When thediscovery process is complete, the view of the web page provided to theuser may be based entirely on the original resources of the web pageprovided by the content publisher.

In addition, in the example of FIG. 1, the original content of the webpage is received from the origin server for the web page, the computingsystem 120, and the flow of data is not re-routed or passed through athird party system such as a proxy server or content delivery network.The flow of data of the web page between the client device 110 and theorigin server remains intact, and the metadata 132 is provided through aseparate channel, independent of the transfer of the original content ofthe web page. As a result, the web page may be transferred from thecontent publisher to the client device 110 over a secure connection, forexample, using Hypertext Transfer Protocol Secure (HTTPS) connection,and still benefit from faster loading using these techniques.

Metadata for speeding up document loading can be generated and providedby a third party, without requiring any inclusion of any custom featuresin the document or any modification of the document. Web pages do notneed to be modified or adapted to take advantage of the technique ofFIG. 1. As a result, enabling acceleration can be done easily byconfiguring a third-party service to provide metadata, without imposingany restrictions on content publishers. As discussed further withrespect to FIG. 8, to permit a particular web page to be loaded faster,a computing system may retrieve the web page, analyze the page andgenerate appropriate metadata, and store the metadata in the datastorage 135 so that the metadata can be provided to other devices.

FIGS. 2A-2C are diagrams that illustrate examples of user interfaces200, 210, 220 shown while a document is loaded. The example illustratesviews of the document provided to a user while a web browser loads thedocument over a network without the benefit of any metadata to speed upthe page loading. As a result, the web browser relies on the typicalresource discovery process exclusively.

In FIG. 2A, the web browser provides the user interface 200 as aninitial view of the document. A portion of the content of the documentis shown, for example, including text 202 in an HTML file of thedocument. However, the web browser has not discovered and processed allof the CSS resources of the document, and so the text is not formattedaccording to the style defined for the text. The web browser hasidentified elements of the web page that must still be retrieved andadded to the view, as shown by placeholders 204. The content of thedocument received and processed so far does not indicate the sizes andpositions these elements should be displayed in the document. The webbrowser generates the layout by estimating the sizes and positions ofthe elements with the limited information available.

In FIG. 2B, the web browser provides the user interface 210 afterdiscovering and processing additional components of the document. Theuser interface 210 is a more complete view of the document, but stillincludes only a portion of the document. A header element 212, a sidebar214, and a footer 216 have been added. These additions required reflowof the page, e.g., a repositioning of elements in the page toaccommodate the changes in layout. The region in which the text 202 isdisplay has changed in size and shape and has moved within the document.The change in layout may be disconcerting to a user, since a userreading the text 202 in the user interface 200 would likely lose hisplace when the interface changes.

In FIG. 2C, the web browser provides the user interface 220 as a finalview of the document after completing the resource discovery process.Changes to the layout and processing of scripts have again caused reflowof the page as the elements previously displayed have been moved andresized. The display area for the text 202 has also changed again. Inaddition, after processing the CSS content of the document, the textstyle (e.g., font size, color, emphasis, font and/or other formatting)for the text 202 has changed. The changes to the layout and formattingof the document during loading may seem abrupt or distracting, and there-arranging of elements may limit the usefulness of the document to theuser until the final, complete view of the document (e.g., userinterface 220) is provided.

FIGS. 3A-3C are diagrams that illustrate examples of user interfaces300, 310, 320 shown while a document is loaded. The example illustratesviews of the same document shown in FIGS. 2A-2C, but as a web browserloads the document using metadata provided to speed up page loading.

In FIG. 3A, the web browser provides the user interface 300 as aninitial view of the document. The web browser has received at least someof the content of the document (e.g., an HTML file) from the originserver for the document. The web browser has also separately receivedmetadata for the document provided by another source (e.g., from a thirdparty.) The layout and formatting of the document content is determinedbased on the metadata provided separate from the resource discoveryprocess that is ongoing to retrieve and process the document from theorigin server. The metadata can include data extracted from thedocument, such as CSS files or portions of the CSS files needed torender the document. In addition, or as an alternative, the metadata caninclude information about the final layout of the page, determined fromanalysis of a prior rendering of the document.

The layout and formatting information in the metadata is used toposition and format content of the document, such as the text 202 thatan HTML file indicates should be displayed to the user. The metadataindicates the sizes and shapes of the elements in the document. Elementsthat have already been retrieved, such as the text 202 that an HTML fileof the document indicates should be displayed, are placed in the displayareas indicated by the metadata. The metadata also indicates where otherelements are placed in the final layout of the document, even though theelements have not yet been discovered in the resource discovery process.Space for these other elements is reserved in the layout, indicated bythe display areas 304 shown in dotted lines. In some implementations,the reserved display areas 304 may include blank space (e.g., showing abackground color or background image of the document). In someimplementations, a placeholder element may be included to indicate tothe user that content will be loaded in that region, or indicate thetype of content to be loaded.

In FIG. 3B, the web browser provides the user interface 310 afterdiscovering and processing additional resources of the document. The webbrowser has blended additional content discovered, such as image filesand other components, with the initial view in the user interface 300.Additional elements have been added to the document, in place of thereserved display areas 304 that were set aside for those elements in thelayout. Even though the web browser has discovered and added newcontent, the layout of the document has not changed. Reflow did notoccur, and the text 202 is displayed in the same region of the documentas in the user interface 300, and with the same font and style. A userthat was reading the text 202 in the user interface 300 would be able tocontinue reading without interruption while the screen is updated toshow the user interface 310. In some implementations, multipleintermediate views of a document may be provided as additional contentof the document is blended with the initial view or subsequent views.

In FIG. 3C, the web browser provides the user interface 320 as a finalor complete view of the document after completing the resource discoveryprocess. All of the reserved display areas 304 have been filed withtheir respective elements. The elements displayed in the previous views(e.g., user interfaces 300, 310) are shown in the same sizes andpositions as before. Because the metadata allowed the web browser togenerate an accurate layout in the initial view of the page, updates tothe page did not require changes to the layout, and reflow was avoided.Although the initial view was not complete (e.g., because somedisplayable elements were not present), use of the information in thesupplemental metadata allowed the elements that were displayed weredisplayed correctly.

The user interface 320 may also incorporate various non-visible changesto the document. For example, processing of JAVASCRIPT may be deferredto allow the user interfaces 300, 310 to be provided with minimal delay.User interaction handlers or other functionality may not have beenactive when the user interfaces 300, 310 were provided. By the time theuser interface 320 is provided, the JAVASCRIPT in the document has beenprocessed. As a result, user interaction handlers or other functionalitymay be active in the document when the user interface 320 is provided.Even if the JAVASCRIPT content describes aspects of the layout orformatting, no changes to the layout are needed in some implementationsbecause the supplemental metadata used to generate the initial view(e.g., the user interface 300) already indicated characteristics of thefinal layout after processing of the JAVASCRIPT content.

The user interface 320 is identical to the user interface 220, since allof the same content of the document (e.g., the original CSS files,JAVASCRIPT files, etc. provided by the content publisher) is retrievedfrom the same URLs and processed by the web browser in both examples.However, in FIGS. 3A-3C, the metadata allows more accurate layout andformatting for initial and intermediate views of the document, so thelayout and formatting can remain consistent while the remainder of thedocument is gradually added.

FIG. 4 is a diagram that illustrates an example of timing of events whenloading a document. In the example, a web browser retrieves andprocesses various resources of the document during a resource discoveryprocess 402. The web browser also retrieves and processes additionalmetadata in acceleration process 404, to quickly provide views of thedocument that have an accurate layout. The document being loadedincludes an HTML file and three other components, in separate resources,that are also needed to render the document. The components may be, forexample, CSS files, JAVASCRIPT files, image files and other media files,font files, HTML files, or other types of resources. The HTML filerefers to the first component, which refers to the second component,which refers to the third component, such that the three components arediscovered sequentially.

At time T₀, the web browser makes a request for the HTML file, e.g., byinitiating a request for the document from the document's URL. Beforereceiving the HTML file, the web browser makes a request to anotherserver, such as a third-party metadata service, for metadata forspeeding up loading of the document. The request for metadata may bemade before, at approximately the same time as, or after the request forthe document. The HTML file and metadata are transferred in parallel,and may be received at approximately the same time. In some instances,the metadata may be received before the HTML file because, for example,the metadata may include less data than the HTML file, and may beprovided by a server system optimized for efficient delivery.

The web browser uses the HTML file and the metadata to generate aninitial view of the document, which is provided at time T₁. Even withoutretrieving and processing the three other resources of the document, byusing the metadata, the web browser can provide a view in which theportions of the document that are shown are displayed with correctlayout and formatting. The metadata may include portions of one or moreof the three components, allowing the web browser to use data from thecomponents before the actual resources are retrieved in the resourcediscovery process 402. The metadata may also indicate sizes andpositions of elements and other information about the document.

After an initial view is provided, the resource discovery process 402continues. The web browser retrieves and processes each of the threeadditional components of the document, and completes processing thesecomponents at times T₃, T₄, and T₅, respectively. At each of times T₃,T₄, and T₅, the web browser provides an updated view of the document,blending additional content with the prior layout and view previouslyprovided. Without the benefit of metadata, the layout of the documentwould not be finalized until time T₅, after the resource discoveryprocess 402 is finished. However, by using the acceleration process 404to retrieve metadata quickly, the final layout is actually generatedmuch earlier, for example, for the initial view of the document.

FIG. 5 is a flow diagram illustrating an example of a process 500 forspeeding up document loading. The process 500 may be performed by theclient device 110 of FIG. 1 or another device.

A device requests a resource of a document from a first source (502).For example, the device may send an HTTP GET request for the resource ata URL for the document (e.g., “GET http://example.com/HTTP/1.1 . . . ”).The request may be sent in response to a user navigating to a web page,for example, by interacting with a link or other user interface element.

In a second request, the device requests metadata for the document froma second source that is different from the first source (504). Thesecond request may be sent in response to the same interaction thattriggered the first request. The device sends the second request beforereceiving the resource requested in action (502), so the resource of thedocument and the metadata may be transferred in parallel or in closesuccession. The request for metadata identifies the document beingloaded, for example, by indicating the URL that is being fetched inaction (502).

In some implementations, the metadata is requested from a third partyindependent of the publisher of the document. The metadata may berequested from a predetermined location or server that is configured toprovide metadata of many different documents from many differentInternet domains and content publishers. For example, the device may beconfigured to request metadata from a specific source, or one of apredetermined set of sources, each time a document is loaded.

The device receives the requested metadata for the document from thesecond source (506). The received metadata may include a copy of datafrom resources of the document (e.g., CSS files, font files, etc.), eventhough the device has not identified or specifically requested theresources. This may allow the device to receive content of variousresources in the document before identifying and retrieving the specificresources that make up the document.

The received metadata may include data from CSS files of the document.For example, the received metadata may include the entirety of one ormore CSS files, or may include only a subset of the data in the CSSfiles that affects the rendering of the document. The received metadatamay indicate layout and formatting information for the document,including, for example, sizes and positions of images and other elementsof the document in a final rendering of the document. The receivedmetadata may include the data of one or more font files, or may identifythe URLs of the font files that are used in the document. The receivedmetadata may identify URLs of images or other elements of the document,allowing the web browser to request these elements more quickly.

In some implementations, the received metadata may include images fromthe document. For example, the metadata may include actual images forthe document, or may include lower resolution images or compressedimages for use in an early view of the document. In someimplementations, when image file data is transferred in metadata, onlyimages that would be visible in the document are provided. In someinstances, fewer than all of the images that would be visible in thedocument are provided. For example, the subset of images provided mayinclude images located at a central region of the document and/or imagesof at least a minimum size, and may exclude the other images of thedocument. In some implementations, the metadata includes only images fordisplay in the document in the above-the-fold region of the document(e.g., in the top portion or initial view of the document that isvisible before scrolling by the user). Other criteria for selectingimages to provide in metadata may be used.

The device receives the requested resource of the document from thefirst source (508). For example, the received resource may be the mainHTML file for the document (e.g., “http://example.com/index.html” fordocument “http://example.com/”).

The device provides, for display, a first representation of the documentbased on the received metadata from the second source (510). The firstrepresentation may be an initial view of the document provided to theuser after the user initiates navigation to the document. The firstrepresentation may include content from one or more resources of thedocument formatted or laid out using the received metadata.

After providing the first representation of the document, the devicegenerates a second representation of the document that combines portionsof the first representation with additional portions of the document(512). The device provides the second representation for display (514).After providing the first representation, the device may continue todiscover and process resources of the document. For example, the secondrepresentation may add content from additional resources of the documentthat were identified and/or received after the first representation wasprovided. New elements may be inserted into the first representation,for example, in place of placeholder elements or into spaces reservedfor the elements. The second representation may be provided withoutreflow (e.g., resizing or re-arranging) elements shown in the firstrepresentation. When processing of JAVASCRIPT or other content isdeferred, the device may process the content. For example, userinteraction handlers may be added to the elements in the firstrepresentation.

The layout and formatting of the first representation may be maintainedin the second representation, for example, because the received metadataindicated a correct layout for the document. The first representation,which may be based on only an initial HTML file and the metadata, may beseamlessly enhanced with incremental changes until the full document isshown.

FIG. 6 is a block diagram that illustrates an example of a system 600for speeding up document loading. The system 600 includes a clientdevice 610, a computing system 620 and a network 618. The figure showsstages (A) to (C) which illustrate a flow of data, and stage (D) whichillustrates a user interface shown on the client device 610.

In the example of FIG. 6, metadata for speeding up loading of a documentis provided before the user 602 of the client device 610 initiatesnavigation to the one or more documents. The client device 610 receivesa referring document that includes a link to a destination document.Loading the referring document transfers metadata for speeding uploading of the destination document. When the user interacts with thelink to the destination document, the metadata (e.g., information aboutlayout and formatting of the destination document) is already present atthe client device 610. As a result, the client device 610 may performaccelerated loading of the destination document without requestingmetadata from a metadata service.

In stage (A), the client device 610 sends a query 612 to the computingsystem 620. In stage (B), the computing system 620 processes the queryand generates a document to provide in response to the query. Thecomputing system 620 may provide the query to a search engine andreceive search results from the search engine, or otherwise obtaininformation responsive to the query. For example, the computing system620 may obtain information that identifies a set of search resultdocuments identified as relevant to the query. The computing system 620generates a document, such as a search engine results page, thatidentifies search result documents.

The computing system 620 also accesses data storage 625 containingmetadata for speeding up page loading. From the data storage 625, thecomputing system 620 identifies metadata for one or more of the searchresult documents, and includes the metadata in the search engine resultspage. In some implementations, the computing system 620 includesmetadata for only the highest-ranking search result document, or foreach of only a highest-ranking subset of the search result documents(e.g., the documents corresponding to the top three or top five searchresults). In some implementations, the computing system 620 includesmetadata for each of the search results identified in the search engineresults page, or for each of the identified search results for whichmetadata is available in the data storage 625.

The metadata 632 may include any of the types of data described hereinfor speeding up page loading, including, for example, data from CSSfiles of the search result documents, information indicating sizes andpositions of elements in the search result documents, data from fontfiles of the search result documents, data indicating resources neededto render the search result documents, and so on.

In stage (C), the computing system 620 provides a search engine resultspage 630 that includes metadata 632 for one or more search resultdocument identified in the search engine results page 630. In someimplementations, the metadata 632 is included in the same file as thesearch engine results page 630. For example, an HTML file for the searchengine results page 630 can include the metadata including CSS contentand layout information for one or more search result documents.

In some implementations, the metadata 632 may be provided in one or morefiles separate from the HTML file of the search engine results page 630.The files may be embedded as resources or components of the searchengine results page that are indicated as needed to complete loading ofthe search engine results page 630. As a result, loading the searchengine results page 630 at the client device 610 may cause the clientdevice 610 to retrieve additional files containing the metadata 632 fromthe computing system 620 or another system. In this manner, the clientdevice 610 may pre-cache the metadata for the search result documents aspart of loading the search engine results page 630.

In stage (D), the client device 610 provides user interface 650, whichincludes a view of the search engine results page 630. The userinterface 650 includes search results 652 a-652 c, which each include alink to a corresponding search result document as a landing page.

When the user 602 interacts with one of the search results 652 a-652 c,the client device 610 requests the corresponding search result document.The client device 610 also uses the metadata 632 for the correspondingsearch result, which was transferred to the client device 610 duringloading of the search engine results page 630, to quickly generate arepresentation of the search result document with accurate formattingand layout. As the resource discovery process continues, the clientdevice 610 updates the view of the search result document, blending theadditional content of with the initial view generated using the metadata632.

In some implementations, the computing system 620 generates the searchengine results page 630 to include interaction handlers that causemetadata 632 to be requested in response to interacting with one of thesearch results 652 a-652 c. For example, instead of automaticallydownloading the metadata 632 as part of loading the search engineresults page 630, user interaction with a link to a search resultdocument may trigger both a first request for the search result documentand a second request for the appropriate metadata 632.

FIG. 7 is a flow diagram that illustrates an example of a process forspeeding up document loading. The process 700 may be performed by thecomputing system 620 of FIG. 7 or another computing system.

The computing system 620 receives user input (702). For example, thecomputing system 620 may receive a search query submitted by a user.

The computing system 620 obtains data responsive to the user input(704). The data identifies a destination document to be referenced in aresponse to the user input. For example, the computing system receivessearch results that each indicate a search result document relevant tothe search query.

The computing system 620 identifies metadata for speeding up loading ofthe destination document (706). For example, the computing system 620can access data storage to identify previously selected data about thelayout and formatting of the destination document, e.g., metadatadesignated as corresponding to the URL of the destination document. Insome implementations, metadata for multiple destination documents, suchas multiple search result documents is included.

The computing system 620 generates a document that includes a link tothe destination document and also includes the metadata for thedestination document (708). In some implementations, the metadata may bepart of the generated document (e.g., in an HTML file). In someimplementations, loading the generated document at a client devicecauses the client device to retrieve the metadata for the destinationdocument. As an example the computing system 620 may generate a searchengine results page having links to search result documents. Theresources that comprise the search engine results page can include themetadata for one or more of the search result documents. Alternatively,the search engine results page may include scripts or other instructionsthat cause the client device to request and receive the metadata for oneor more result documents.

The computing system 620 provides the generated document in response tothe user input (710). Transferring or processing the generated documentcan transfer the metadata for the destination document. After loadingthe generated document, when a client device navigates to thedestination document, metadata for speeding up loading of thedestination document is already present at the client device.

FIG. 8 is a flow diagram that illustrates an example of a process forspeeding up document loading. The example of FIG. 8 describes techniquesfor generating metadata for documents, and then providing the metadatain response to requests for metadata.

A computing system retrieves a document (802). For example, web pagescan be crawled so that the data of the web pages is obtained. Documentscan be obtained as part of crawling for indexing or other purposes. Thecomputing system may receive all the resources that are components of adocument or affect the display of the document.

The computing system renders the document (804). For example, thedocument can be rendered with a layout engine a web browser (e.g., a webbrowser engine or rendering engine), such as Webkit or Gecko. Whenrendering the document, the layout engine obtains and processes allresources of the document, including CSS files, JAVASCRIPT files, fontfiles, and all other resources that affect the display of the document.The computing system can produce the same rendering result that a clientdevice would produce by discovering and producing all the embeddedresources in the document. The computing device may generate therendering using a “headless” mode, without any visual display of therendered content. In some implementations, the layout engine produces arender tree and a document object model (DOM) tree.

The computing system extracts metadata for the document using therendering of the document (806). The computing system analyzes therendering, for example, inspecting the DOM tree, the render tree, andthe final layout for the document. The metadata extracted may includevarious characteristics of the layout and formatting of the page. Thecomputing system may apply a set of predetermined rules to determine,for example, which elements are visible in the rendering and the sizesand positions of the elements. Because a final, complete rendering isanalyzed, the layout characteristics already reflect any layout featuresadded or adjusted by processing of JAVASCRIPT or other instructions inthe page.

The computing system can also walk through the DOM tree and render treeto identify which resources of the document are actually used to affectthe display of the document. In addition, the computing system candetermine which portions within a particular resource affect the displayof the document. For example, the computing system can determine that aparticular CSS file provides styles for the document, but only a subsetof the styles defined are actually used in the document. The computingsystem includes in the metadata the CSS data that actually affects thedisplay of the document, and omits CSS data that does not affect thedisplay of the document. Data from multiple different resources of thedocument (e.g., multiple CSS files, font files, etc.) can be included inthe metadata that is extracted. The metadata may additionally oralternatively indicate characteristics of the DOM tree or the rendertree.

In addition, or as an alternative, the metadata may be generated basedon data from other users that have previously rendered the document. Forexample, characteristics of renderings on one or more user devices,rather than a server system, may be used to select metadata. Priorrenderings may indicate, for example, where the fold of the page islocated on a certain device or class of devices, which images aredisplayed above the fold, the size and position of images and otherelements, which CSS data is needed to render the document, or otherinformation about the document.

The extracted metadata generally excludes the visual elements of thedocument. For example, the title and body text may be excluded, but theCSS data that defines the styles for the text may be included.Similarly, the actual images of the document may be excluded, butinformation indicating the size and position of the images in the layoutmay be included.

The displayable elements in documents change frequently, but the overalldesign of a document changes much less frequently. As a result, metadatathat describes the formatting and layout of the document may remainvalid for a much longer time than displayable elements. For example, aweb page may include a body region including text that is frequentlyupdated. However, the text style and the size and position of the bodyregion may be consistent for days, weeks, or months. Similarly, a webpage may include an image, and although the particular image includedmay change from time, the web page may consistently include an imagewith the same position and/or size (e.g., in the top right corner, at300 pixels by 300 pixels).

Omitting displayable content may have other advantages also. Forexample, if the document changes and the metadata used to generate aninitial view of the document, inaccuracy in layout and formatting may beless distracting than, for example, providing an out-of-date image ortext. Similarly, the layout and formatting of a document are typicallynot sensitive, and could be provided for secure content.

The computing system stores the extracted metadata for the document(808). For example, the computing system can associate the metadata withthe URL of the document or another identifier for the document. Then,when a request for metadata is received that identifies the particulardocument, the metadata specific to the identified document can beprovided.

Metadata can be generated by a third party, without changes to documentsby the authors of the documents. As a result, a service for providingmetadata can be scaled to provide metadata for a large number ofdocuments. No changes to the manner of delivery of the document or theresources of the document are needed to allow metadata to be providedfor speeding up page loading.

The actions (802) to (808) can be repeated for each of multipledocuments, including documents from many publishers or Internet domains.For example, a system may store metadata for multiple documents to beable to provide a metadata for any of the multiple documents.

After metadata for the document has been stored, the computing systemreceives a request for metadata of the document (810). For example, thecomputing system receives a request that identifies a URL of thedocument.

In response to the request, the computing system identifies the storedmetadata corresponding to the document (812). For example, the computingsystem accesses the metadata designated as corresponding to the URL.

The computing system provides the metadata corresponding to the documentin response to the request (814). By providing the metadata, thecomputing system may include the portions of resources, such as CSSfiles, that are needed to generate a correct layout of the document,before the device requesting the metadata identifies the particularresources that are part of the document.

In some implementations, the actions (802) to (808) are performed as aseparate process, for example, as a pre-processing phase to generate acollection of metadata for one or more documents. Similarly, actions(810) to (814) may be performed as a separate process, for example, toprovide a metadata service after a library of metadata is generated, oris provided by another system.

In some implementations, a web browser may be configured to requestmetadata from the origin server for a document, rather than from athird-party metadata service. For example, the HTML file for a documentand a request for metadata to speed up loading could be requested fromthe same server. Authors of documents could individually identify themetadata of their pages that would assist devices to more quicklygenerate initial views of the documents, and could provide the metadatabefore the individual resources containing the metadata are requested.

The techniques described above allow metadata to be extracted for publicdocuments provided through secured protocols such as HTTPS. Metadata maybe provided by a third party and used to speed up page loading even whenthe resources of the document are transferred over HTTPS the originserver. The actual resources of the document do not flow through thethird party server, since the metadata is provided separately as anadditional aid in the loading process.

In some implementations, a computing system can receive informationregarding a rendering of a document from a client device. In instanceswhere the computing system is not able to access a document, informationabout the document provided by client devices may be used to identifymetadata from the document for speeding up page loading. For example,after rendering a document, a web browser can provide information about,for example, the sizes and positions of elements in the page. The webbrowser may indicate the formatting and styles used, and may provideinformation derived from the DOM tree or render tree for the document.In general, the web browser may indicate general properties of thelayout of the document while omitting personalized content and otherinformation displayed in the document. Submissions from many webbrowsers of many different may allow the computing system to collectinformation about renderings of various pages that the computing systemis not able to retrieve. In some implementations, users may be providedthe option whether their devices provide information to the server, andlayout and other document properties may be sent only when a user hasopted in to allow submission of document information.

A number of implementations have been described. Nevertheless, it willbe understood that various modifications may be made without departingfrom the spirit and scope of the disclosure. For example, various formsof the flows shown above may be used, with steps re-ordered, added, orremoved.

Embodiments and all of the functional operations described in thisspecification may be implemented in digital electronic circuitry, or incomputer software, firmware, or hardware, including the structuresdisclosed in this specification and their structural equivalents, or incombinations of one or more of them. Embodiments may be implemented asone or more computer program products, i.e., one or more modules ofcomputer program instructions encoded on a computer-readable medium forexecution by, or to control the operation of, data processing apparatus.The computer readable-medium may be a machine-readable storage device, amachine-readable storage substrate, a memory device, a composition ofmatter affecting a machine-readable propagated signal, or a combinationof one or more of them. The computer-readable medium may be anon-transitory computer-readable medium. The term “data processingapparatus” encompasses all apparatus, devices, and machines forprocessing data, including by way of example a programmable processor, acomputer, or multiple processors or computers. The apparatus mayinclude, in addition to hardware, code that creates an executionenvironment for the computer program in question, e.g., code thatconstitutes processor firmware, a protocol stack, a database managementsystem, an operating system, or a combination of one or more of them. Apropagated signal is an artificially generated signal, e.g., amachine-generated electrical, optical, or electromagnetic signal that isgenerated to encode information for transmission to suitable receiverapparatus.

A computer program (also known as a program, software, softwareapplication, script, or code) may be written in any form of programminglanguage, including compiled or interpreted languages, and it may bedeployed in any form, including as a standalone program or as a module,component, subroutine, or other unit suitable for use in a computingenvironment. A computer program does not necessarily correspond to afile in a file system. A program may be stored in a portion of a filethat holds other programs or data (e.g., one or more scripts stored in amarkup language document), in a single file dedicated to the program inquestion, or in multiple coordinated files (e.g., files that store oneor more modules, sub programs, or portions of code). A computer programmay be deployed to be executed on one computer or on multiple computersthat are located at one site or distributed across multiple sites andinterconnected by a communication network.

The processes and logic flows described in this specification may beperformed by one or more programmable processors executing one or morecomputer programs to perform functions by operating on input data andgenerating output. The processes and logic flows may also be performedby, and apparatus may also be implemented as, special purpose logiccircuitry, e.g., an FPGA (field programmable gate array) or an ASIC(application specific integrated circuit).

Processors suitable for the execution of a computer program include, byway of example, both general and special purpose microprocessors, andany one or more processors of any kind of digital computer. Generally, aprocessor will receive instructions and data from a read only memory ora random access memory or both. The essential elements of a computer area processor for performing instructions and one or more memory devicesfor storing instructions and data. Generally, a computer will alsoinclude, or be operatively coupled to receive data from or transfer datato, or both, one or more mass storage devices for storing data, e.g.,magnetic, magneto optical disks, or optical disks. However, a computerneed not have such devices. Moreover, a computer may be embedded inanother device, e.g., a tablet computer, a mobile telephone, a personaldigital assistant (PDA), a mobile audio player, a Global PositioningSystem (GPS) receiver, to name just a few. Computer readable mediasuitable for storing computer program instructions and data include allforms of non-volatile memory, media and memory devices, including by wayof example semiconductor memory devices, e.g., EPROM, EEPROM, and flashmemory devices; magnetic disks, e.g., internal hard disks or removabledisks; magneto optical disks; and CD-ROM and DVD-ROM disks. Theprocessor and the memory may be supplemented by, or incorporated in,special purpose logic circuitry.

To provide for interaction with a user, embodiments may be implementedon a computer having a display device, e.g., a CRT (cathode ray tube) orLCD (liquid crystal display) monitor, for displaying information to theuser and a keyboard and a pointing device, e.g., a mouse or a trackball,by which the user may provide input to the computer. Other kinds ofdevices may be used to provide for interaction with a user as well; forexample, feedback provided to the user may be any form of sensoryfeedback, e.g., visual feedback, auditory feedback, or tactile feedback;and input from the user may be received in any form, including acoustic,speech, or tactile input.

Embodiments may be implemented in a computing system that includes aback end component, e.g., as a data server, or that includes amiddleware component, e.g., an application server, or that includes afront end component, e.g., a client computer having a graphical userinterface or a Web browser through which a user may interact with animplementation of the techniques disclosed, or any combination of one ormore such back end, middleware, or front end components. The componentsof the system may be interconnected by any form or medium of digitaldata communication, e.g., a communication network. Examples ofcommunication networks include a local area network (“LAN”) and a widearea network (“WAN”), e.g., the Internet.

The computing system may include clients and servers. A client andserver are generally remote from each other and typically interactthrough a communication network. The relationship of client and serverarises by virtue of computer programs running on the respectivecomputers and having a client-server relationship to each other.

While this specification contains many specifics, these should not beconstrued as limitations, but rather as descriptions of featuresspecific to particular embodiments. Certain features that are describedin this specification in the context of separate embodiments may also beimplemented in combination in a single embodiment. Conversely, variousfeatures that are described in the context of a single embodiment mayalso be implemented in multiple embodiments separately or in anysuitable subcombination. Moreover, although features may be describedabove as acting in certain combinations and even initially claimed assuch, one or more features from a claimed combination may in some casesbe excised from the combination, and the claimed combination may bedirected to a subcombination or variation of a subcombination.

Similarly, while operations are depicted in the drawings in a particularorder, this should not be understood as requiring that such operationsbe performed in the particular order shown or in sequential order, orthat all illustrated operations be performed, to achieve desirableresults. In certain circumstances, multitasking and parallel processingmay be advantageous. Moreover, the separation of various systemcomponents in the embodiments described above should not be understoodas requiring such separation in all embodiments, and it should beunderstood that the described program components and systems maygenerally be integrated together in a single software product orpackaged into multiple software products.

Thus, particular embodiments have been described. Other embodiments arewithin the scope of the following claims. For example, the actionsrecited in the claims may be performed in a different order and stillachieve desirable results.

What is claimed is:
 1. A method comprising: receiving, by one or morecomputers of a server system, a request corresponding to a document,wherein the document includes script content configured to be processedby a client device upon loading of the document by the client device;obtaining, by the one or more computers of the server system, dataindicating results of processing the script content of the document,wherein obtaining the data indicating the results of processing thescript content of the document comprises accessing the data indicatingthe results from stored data generated before receiving the request; andproviding, by the one or more computers of the server system, a responseto the request that includes the data indicating results of processingthe script content, the response being provided such that the clientdevice receiving the response can generate a view of the documentshowing the results of processing the script content without the clientdevice receiving and processing the script content.
 2. The method ofclaim 1, wherein the data indicating the results is based on one or moreprior renderings of the document, the one or more prior renderings beingmade by interpreting the script content by one or more devices that areeach different from the client device that initiated the request for thedocument.
 3. The method of claim 1, wherein the script content isconfigured to affect a layout of one or more elements of the document.4. The method of claim 1, wherein the document is a web page, andwherein the script content is configured to adjust a position or size ofan element displayed in a view of the web page.
 5. The method of claim1, wherein the script content is configured to alter a document objectmodel (DOM) for the document.
 6. The method of claim 1, wherein thescript content is embedded through a reference in a first file of thedocument that, when loaded, causes retrieval and processing of a secondfile including the script content; and wherein data indicating resultsof processing the script content is configured to enable the clientdevice to generate the view of the document without the client deviceobtaining and processing the second file.
 7. The method of claim 1,comprising: identifying the document; determining that the documentincludes the script content; processing the script content using one ormore devices; and storing data indicating results of processing thescript content in association with the document; wherein obtaining thedata indicating the results of processing the script content of thedocument comprises, in response to receiving the request, retrieving thestored data associated with the document; and wherein providing theresponse to the request that includes the data indicating results ofprocessing the script content comprises providing a response thatincludes the retrieved data associated with the document.
 8. A systemcomprising: one or more computers of a server system; and one or morecomputer-readable media storing instructions that, when executed by theone or more computers, cause the server system to perform operationscomprising: receiving, by the one or more computers of the serversystem, a request corresponding to a document, wherein the documentincludes script content configured to be processed by a client deviceupon loading of the document by the client device; obtaining, by the oneor more computers of the server system, data indicating results ofprocessing the script content of the document, wherein obtaining thedata indicating the results of processing the script content of thedocument comprises accessing the data indicating the results from storeddata generated before receiving the request; and providing, by the oneor more computers of the server system, a response to the request thatincludes the data indicating results of processing the script content,the response being provided such that the client device receiving theresponse can generate a view of the document showing the results ofprocessing the script content without the client device receiving andprocessing the script content.
 9. The system of claim 8, wherein thedata indicating the results is based on one or more prior renderings ofthe document, the one or more prior renderings being made byinterpreting the script content by one or more devices that are eachdifferent from the client device that initiated the request for thedocument.
 10. The system of claim 8, wherein the script content isconfigured to affect a layout of one or more elements of the document.11. The system of claim 8, wherein the document is a web page, andwherein the script content is configured to adjust a position or size ofan element displayed in a view of the web page.
 12. The system of claim8, wherein the script content is configured to alter a document objectmodel (DOM) for the document.
 13. The system of claim 8, wherein thescript content is embedded through a reference in a first file of thedocument that, when loaded, causes retrieval and processing of a secondfile including the script content; and wherein data indicating resultsof processing the script content is configured to enable the clientdevice to generate the view of the document without the client deviceobtaining and processing the second file.
 14. One or more non-transitorycomputer-readable media storing instructions that, when executed by oneor more computers of a server system, cause the server system to performoperations comprising: receiving, by the one or more computers of theserver system, a request corresponding to a document, wherein thedocument includes script content configured to be processed by a clientdevice upon loading of the document by the client device; obtaining, bythe one or more computers of the server system, data indicating resultsof processing the script content of the document, wherein obtaining thedata indicating the results of processing the script content of thedocument comprises accessing the data indicating the results from storeddata generated before receiving the request; and providing, by the oneor more computers of the server system, a response to the request thatincludes the data indicating results of processing the script content,the response being provided such that the client device receiving theresponse can generate a view of the document showing the results ofprocessing the script content without the client device receiving andprocessing the script content.
 15. The one or more non-transitorycomputer-readable media of claim 14, wherein the data indicating theresults is based on one or more prior renderings of the document, theone or more prior renderings being made by interpreting the scriptcontent by one or more devices that are each different from the clientdevice that initiated the request for the document.
 16. The one or morenon-transitory computer-readable media of claim 14, wherein the scriptcontent is configured to affect a layout of one or more elements of thedocument.
 17. The one or more non-transitory computer-readable media ofclaim 14, wherein the document is a web page, and wherein the scriptcontent is configured to adjust a position or size of an elementdisplayed in a view of the web page.
 18. The one or more non-transitorycomputer-readable media of claim 14, wherein the script content isconfigured to alter a document object model (DOM) for the document. 19.The one or more non-transitory computer-readable media of claim 14,wherein the script content is embedded through a reference in a firstfile of the document that, when loaded, causes retrieval and processingof a second file including the script content; and wherein dataindicating results of processing the script content is configured toenable the client device to generate the view of the document withoutthe client device obtaining and processing the second file.
 20. The oneor more non-transitory computer-readable media of claim 14, wherein theoperations comprise: identifying the document; determining that thedocument includes the script content; processing the script contentusing one or more devices; and storing data indicating results ofprocessing the script content in association with the document; whereinobtaining the data indicating the results of processing the scriptcontent of the document comprises, in response to receiving the request,retrieving the stored data associated with the document; and whereinproviding the response to the request that includes the data indicatingresults of processing the script content comprises providing a responsethat includes the retrieved data associated with the document.